<?php 
$_errTempId = 'a'.mt_rand(0,100000000);
?>
<center>
<div style="font-size: 11px; color:#333333; font-family:'Courier New', Courier, monospace; margin-top: 50px;">
	<table cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td style="background: url(<?php echo $TEMPLATE_URL?>Images/shadowLeft.png) repeat-y top;" valign="top"><img src="<?php echo $TEMPLATE_URL?>Images/shadowCorner.png"></td>
			<td>
				<div style="border: 1px solid #000000; max-width:1000px; background:url(<?php echo $TEMPLATE_URL?>Images/bottomLine.png) repeat-x bottom; pad/ding-right:3px;">
					<div style="background:url(<?php echo $TEMPLATE_URL?>Images/topLine.png) repeat-x; height: 50px;">
						<img src="<?php echo $TEMPLATE_URL.'Images/Error.png' ?>" style="float:left; margin: 5px;" >
						<div style="padding: 14px 5px 5px 5px; float:left; color:#FFFFFF; font-weight:bold;">
							Tekkinud on viga!
						</div>
						<img src="<?php echo $TEMPLATE_URL?>Images/topRightCorner.png" style="float: right; position: relative; top:-1px; right:-1px; /right:-4px;">
					</div>
					<div style="padding: 0px 5px 8px 5px; font-size: 13px; line-height:1.5;">
						<?php if( $SAFE == true ) {?>
							Administraatoritele on antud veast teada antud ja sellega tegeletakse!<br>
							<br>
							Vajutage <a href="javascript:history.go(-1)" style="color:#333333;">siia</a>, et liikuda tagasi eelmisele lehel!
						<?php } else {?>
						
							<strong style="color: #990000;"><?php echo get_class($exception) ?></strong>(<span style="color: #003399;font-weight: bold;"><?php echo $exception->getCode() ?></span>): <?php echo $exception->getMessage() ?><br>
							
							<b>Thrown in</b> 
							<span style="color: #996600"><?php echo dirname($exception->getFile()) ?>\<strong><?php echo basename($exception->getFile())?></strong></span> 
							on line <span style="color: #003399;font-weight: bold;"><?php echo $exception->getLine() ?></span><br>
							
							<span onClick="e=document.getElementById('<?php echo $_errTempId ?>'); if(e.style.display=='none'){e.style.display='';}else{e.style.display='none';}" style="cursor:pointer"><b>Show backtrace</b></span>
							<div>
								<div id="<?php echo $_errTempId?>" <?php if( !$BACKTRACE_OPEN ) echo 'style="display:none;"'; ?>>
									<?php foreach( $exception->getTrace() as $desc) { ?>
									called <span style="color: #006633"><strong><?php echo $desc['class'].$desc['type'].$desc['function'] ?></strong></span> 
										in 
									<span style="color: #996600"><?php echo dirname($desc['file']) ?>\<strong><?php echo basename($desc['file'])?></strong></span> 
									on line <span style="color: #003399;font-weight: bold;"><?php echo $desc['line'] ?></span><br>
									<?php }?>
									<br>
								</div>
								Datetime: <?php echo date('d-m-Y H:i:s')?><br />
								Client ip: <?php echo ip(); ?><br />
								Ref: <?php echo $REF ?><br />
								Url: <?php echo $URL ?><br />	
								<?php if( count($_REQUEST) > 0 ) { ?>
									<span style="cursor:pointer;" onClick="e=document.getElementById('post<?php echo $_errTempId ?>'); if(e.style.display=='none'){e.style.display='';}else{e.style.display='none';}"><b>Show request parameters</b></span>
									<div id="post<?php echo $_errTempId?>" <?php if( !$BACKTRACE_OPEN ) echo 'style="display:none;"'; ?>>
										<table style="width:100%; font-size:11px; background-color:rgb(238,238,238)" cellspacing="1" cellpadding="1" border="0">
											<?php foreach($_REQUEST as $var => $value) { ?>
											<tr>
												<td style="width:140px; background-color:#FFF" valign="top" align="left"><b><?php echo $var ?></b></td>
												<td style="background-color:#FFF" valign="top" align="left"><?php echo $value ?></td>
											</tr>
											<?php } ?>
										</table>
										<br>
									</div>
								<?php } ?>
							</div>	
						<?php }?>
					</div>
				</div>
			</td>
		</tr>
		<tr>
			<td style="background:url(<?php echo $TEMPLATE_URL?>Images/shadowBottom.png) repeat-x top; height: 4px; text-align:left; font-size:0px;">
				<img src="<?php echo $TEMPLATE_URL?>Images/shadowBottomCorner.png">
			</td>
			<td style="background:url(<?php echo $TEMPLATE_URL?>Images/shadowBottom.png) repeat-x top; height: 4px; text-align:right; font-size:0px;">
				<img src="<?php echo $TEMPLATE_URL?>Images/shadowRightCorner.png">
			</td>
		</tr>
	</table>
</div>
</center>